package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.plate.*;
import com.zmj.sy.mom.srv.aps.service.PlateStandardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "标准钢板")
@RestController
@RequestMapping("/plateStandard")
public class PlateStandardController {

    private final PlateStandardService plateStandardService;

    @ApiOperation("标准钢板查询")
    @GetMapping("/plateList")
    public BasePageResVo<PlateStandardResVo> plateList(PlateStandardReqVo reqVo) {
        return plateStandardService.plateList(reqVo);
    }

    @ApiOperation("标准钢板添加")
    @PostMapping("/plateAdd")
    public BaseResVo plateAdd(@RequestBody PlateStandardAddReqVo reqVo) {
        plateStandardService.plateAdd(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("标准钢板编辑")
    @PostMapping("/plateEdit")
    public BaseResVo plateEdit(@RequestBody PlateStandardEditReqVo reqVo) {
        plateStandardService.plateEdit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("标准钢板删除")
    @PostMapping("/plateDelete")
    public BaseResVo plateDelete(BaseIdReqVo reqVo) {
        plateStandardService.plateDelete(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("自动添加指定材质厚度标准板")
    @PostMapping("/autoCreatePlate")
    public BaseResVo autoCreatePlate(@RequestBody PlateStandardCreateResVo reqVo) {
        plateStandardService.autoCreatePlate(reqVo);
        return BaseResVo.ok();
    }

}
